home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / HackAddict™ Magazine / HA 1-12 / HackAddict05.sit / HackAddict 5 ƒ / HackAddict 5.rsrc / TEXT_130.txt < prev    next >
Text File  |  1997-09-01  |  9KB  |  247 lines

  1.   A Little More Advanced Guide 
  2.         to UNIX Hacking
  3.  
  4.  
  5.  
  6.      The article in HackAddict 1 was designed to be more of a guide to cracking the password file instead of the actual UNIX hacking. This will be more about UNIX and less about Macintosh. I have borrowed several concepts and terms from the original article so don't surprised if things sound familiar.
  7.  
  8.  
  9.  
  10. Section 1. What is UNIX and why would I need it?
  11.  
  12.      UNIX is an operating system made by AT&T in 1969. Made by programmers, for programmers. It also supposedly has very little security. The name is a play off of Multics, its precursor OS, supposedly UNIX would unify the previous Multics, which was a mess.
  13.  
  14.      UNIX is an operating system that runs on a variety of different kinds of machines. There are many little brothers and sisters of UNIX including Linux, Solaris, Sun OS, AIX, and many, many more. UNIX is usually command-line based (like DOS) and has a variety of commands and functions.
  15.  
  16.  
  17.      I read somewhere that 67% of all Internet servers were UNIX-based. Even the companies you would least expect run their www sites on UNIX boxes. Apple Computer, Microsoft Corp, MacWorld, Motorola, and many many more. (Just for the record, the Mac OS was second with 23%, followed by Windows NT with 8%) This means that if you plan on hacking Internet servers, you had better know UNIX. 
  18.  
  19.  
  20.  
  21. Section 2. What does UNIX look like?
  22.  
  23.      A UNIX system has two major parts. The shell and the kernel. 
  24.  
  25.      The kernel is the base of the UNIX OS. It is always running and invisible to users. It handles all OS functions behind the scenes and manages the computer. 
  26.  
  27.      The shell is the actual part of the UNIX OS that handles commands from the user to the computer. You can execute "scripts" from within this shell that allow you perform more advanced functions than are already provided. The commands already provided are executed wihin the shell and allow users to view and edit files, interact with other users, and execute programs.
  28.  
  29.  
  30.      When you log onto a UNIX-based system, you should see some kind of login screen that tells you the little brother of UNIX this box is running. For example:
  31.  
  32.  
  33. UNIX System V Release 4.0  (Genesis)
  34.  
  35. login:
  36.  
  37.  
  38.  
  39.  
  40.  
  41. You should at this point enter your login and password. If you do not have a login I would suggest reading HackAddict 1. It will tell you more about getting UNIX logins. We will now explore UNIX commands.
  42.  
  43.  
  44.  
  45. Section 3. Basic UNIX Commands.
  46.  
  47.      When you log into a UNIX system it should give you a screen that looks like this:
  48.  
  49.  
  50. Welcome to Genesis. Last login: 8/29/97 12:33:45 P.M. from max125.cruzio.com.
  51.  
  52. You have new mail.
  53. $
  54.  
  55.  
  56. The "$" is the prompt. It means that it is waiting for a command. Other prompts include "%" and "#". Type "help" for info on that particular computers specific commands. The following commands work for all little borthers of UNIX.
  57.  
  58. ls - Gives a listing of the files in the current directory. (that is LS)
  59.  
  60. Example:
  61.  
  62. $ ls
  63.  
  64.   /mydir          /onemoredir
  65.   /anotherdir     file.txt
  66.  
  67.  
  68. cd - Change directory.
  69.  
  70. Exaample:
  71.  
  72. $ cd /pub/www/weasel/
  73. $ ls 
  74.  
  75.   /mydir          /onemoredir
  76.   /anotherdir     file.txt
  77.  
  78.  
  79. If we want to go to the root directory we would type:
  80.  
  81. $ cd /
  82.  
  83.  
  84. cat - Shows you the content of a file.
  85.  
  86. Example: 
  87.  
  88. $ cat file.txt
  89.   The Weasel is the best!
  90.  
  91.  
  92. cp - Copy a file.
  93.  
  94. Example:
  95.  
  96. $ cp file file2       /* This will duplicate the file and */
  97.                       /* rename the copy "file2"          */
  98.  
  99. $ cp file /home/dir/  /* Makes a copy of "file" and moves */
  100.                       /* it to /home/dir/                 */
  101.  
  102.  
  103. mv - Moves a file to another directory. Folows mv filename directory.
  104.  
  105. Example:
  106.  
  107. $ mv file.txt home/weasel
  108.  
  109.  
  110. rm - Delete a file. Directories follow "rm -r directory" files follow "rm file".
  111.  
  112. Example:
  113.  
  114. $ rm -r weasel
  115.  
  116.  
  117. Example2: 
  118.  
  119. $ rm file.txt
  120.  
  121.  
  122. who - Shows who else is logged onto the system.
  123.  
  124. Example:
  125.  
  126. $ who
  127.  
  128.   login     term     logontime
  129.   root   +  tty001   12:00:00
  130.   weasel +  tty112    7:32:35
  131.  
  132.  
  133. chown - Change file's owner.
  134.  
  135. Example:
  136.  
  137. $ chown weasel file.txt
  138.  
  139.  
  140. finger - Provides more info about a certain user.
  141.  
  142. Example:
  143.  
  144.  
  145. $ finger weasel
  146.  
  147.   Name: The Weasel
  148.   Login: weasel
  149.   Last login: 8/29/97 12:33:45 P.M
  150.   User "weasel" is not currently logged on.
  151.   
  152. (there would probably be more info, but I wanted to keep it short)
  153.  
  154.  
  155.  
  156. mail - If you are running a Macintosh you really shouldn't need this. It is the UNIX e-mail program used for mailing not only people on your own server, but people on other servers. 
  157.  
  158.  
  159.  
  160.  
  161. Section 4. Account structure, file management, and permissions.
  162.      
  163.      Think of UNIX as having two kinds of users. Power holders and peons. Power holders have access at the root level. Each account is assigned a number or a "UID". (user ID) Root's UID is 0. Any user whose UID is 0 has root access. Any other users have power only over other users using their ID. So if Bob and I both have a UID of 10, we have power over each other, but nobody else.
  164.      
  165.      You have to understand what the UNIX file structure looks like if you are ever going to try to raise your access or even mess around. The following picture should help you out:
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.      This should help you to understand file permissions. Every user belongs to a "group". All the users in your group have access to the same things and have the same UID. When you attempt to access a file, UNIX looks at your UID and decides if your group UID has enough permissions.
  182.  
  183.      Every file has an owner. This is usually the user who creates the file. This can be changed by using chown. (see Section 3) Files have certain permissions that are usually set by the owner. These are execute, read, and write. Execute means you can run the program (if it is a program) in the shell. Read means that you can read, but not edit the file. Write means you can edit (or delete!) the file. If you look at the long version of a directory entry it would loook like this:
  184.  
  185. rwxrw-r-- weasel       guest     56447 September 1  shadow.c
  186.  
  187.  
  188. These 9 characters represent three things. The first three represent the owner's file permissions, the second three represent the group's file permissions, and the last three represent other user's permissions. r stands for read, w stands for write, and x stands for execute. So the group permissions on this file are read and write, but not execute.
  189.  
  190.  
  191.  
  192. Section 5. Getting into a UNIX system.
  193.  
  194.      I documented this fully in HackAddict 1 so I will not go into much depth here. I will just go over a few things I forgot to mention in that article. 
  195.  
  196.      You can use command logins to find out info about the system. You will type these in place of a login. They are: who, rwho, and finger. Who will show who is currenly logged into the system. Rwho will do pretty much the same thing on different systems. Finger will show a bit more advance info about a certain user. You can write the logins down and try to use them as logins. Try using the login as the password and maybe you'll find a stupid user.
  197.  
  198.  
  199.  
  200. Section 6. Interesting files in the UNIX system.
  201.  
  202.      
  203. - etc/passwd - The best file on UNIX. It is the password file everyone wants. It should follow this form:
  204.  
  205.      Username:Password (encrypted):UserID:GroupID:Name:Home directory:Shell
  206.  
  207.      Example:
  208.  
  209.    weasel:k5h3kljh6&atg:21:21:TW:/home/usr/weasel:/bin/sh
  210.  
  211.  
  212.      If the password looks like this:
  213.  
  214.     weasel:x:TW:/home/usr/weasel:/bin/sh
  215.  
  216.      That means it is shadowed. More and more systems are getting shadowed these days making it harder and harder to hack into them. If it is shadowed try looking in the directory etc/shadow/ for backups of the password file.
  217.  
  218.  
  219.  
  220. - etc/group - This file shows all the groups on the system. Interesting for knowing who has what.
  221.  
  222.  
  223.  
  224. - usr/adm/loginlog - This file has all logins and attempted logins stored. Many systems keep this off, but if you can find it...
  225.  
  226.  
  227.  
  228. - /usr/adm/errlog - This is the error log. Pretty self-explanatory.
  229.  
  230.  
  231.  
  232.  
  233.  
  234. Section 7. Closing notes and thanks.
  235.  
  236.      I hope I have helped you to more understand the UNIX system. If I were you I would grab a copy of Better Telnet and start messing around with computers on the Internet. There are millions of possible targets. Just start practicing and mess around. I have also included a bunch of scripts for use in a UNIX system. You really need a good login to use these. 
  237.  
  238.      Well that about wraps it up! If you have any questions about the UNIX OS feel free to e-mail me.
  239.      
  240.  
  241.  
  242. The Weasel - Potestas rus homines!
  243.  
  244.  
  245. weasel@yatho.com
  246.  
  247.